//
//  SZBaseTabBarController.m
//  KaiJing
//
//  Created by lanou on 16/1/11.
//  Copyright © 2016年 HuangZuCui. All rights reserved.
//

#import "SZBaseTabBarController.h"
#import "SZMineMainController.h"
#import "SZPictorialViewController.h"
#import "SZRecommendMainController.h"
#import "SZYingKUMainViewController.h"
#import "SZPictorialViewController.h"
@interface SZBaseTabBarController ()

@end

@implementation SZBaseTabBarController

- (void)viewDidLoad {
    [super viewDidLoad];
    
    [self addViewControllerClass:[SZRecommendMainController class] title:@"推荐" imageName:@"recommend_normal" selectImageName:@"recommend_selected"];
    [self addViewControllerClass:[SZYingKUMainViewController class] title:@"影库" imageName:@"yingku_normal" selectImageName:@"yingku_selected"];
    [self addViewControllerClass:[SZPictorialViewController class] title:@"画报" imageName:@"pictorial_normal" selectImageName:@"pictorial_selected"];
    [self addViewControllerClass:[SZMineMainController class] title:@"我的" imageName:@"mine_normal" selectImageName:@"mine_selected"];
    
}

/**
 *  添加tabBar上的控制器
 *
 *  @param class           控制器的名字
 *  @param title           标题
 *  @param imageName       图片
 *  @param selectImageName 选中图片
 */
- (void)addViewControllerClass:(Class)class title:(NSString *)title imageName:(NSString *)imageName selectImageName:(NSString *)selectImageName
{
    UIViewController *viewC = [[class alloc]init];
    UINavigationController *navC = [[UINavigationController alloc] initWithRootViewController:viewC];
    navC.tabBarItem.title = title;
    navC.tabBarItem.image = [UIImage imageNamed:imageName];
    navC.tabBarItem.selectedImage = [[UIImage imageNamed:selectImageName] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];// 显示实际图片
    viewC.navigationItem.title = title;
    [self addChildViewController:navC];
}

@end
